package map.android.baidu.carpool.data.impl;

import android.content.Context;
import android.text.TextUtils;
import map.android.baidu.carpool.WebConfig;
import map.android.baidu.carpool.data.CarpoolBaseData;
import map.android.baidu.carpool.response.OrderCancelResponse;
import map.android.baidu.carpool.setting.UserInfoSetting;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhangtongyu on 15/3/23.
 * main模块取消订单接口的request
 */
public class OrderCancelData extends CarpoolBaseData<OrderCancelResponse> {

    private String orderNo; //必传得订单编号
    private String cancelReason = "";
    private String cancelContent = "";

    public OrderCancelData(Context context) {
        super(context);
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }

    public void setcancelContent(String cancelContent) {
        this.cancelContent = cancelContent;
    }

    @Override
    protected String getUrl() {
        return WebConfig.getUrl(WebConfig.URL_ID_ORDER_CANCEL);
    }

    @Override
    protected Map<String, String> getParams() {
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("orderId", orderNo);
        params.put("bduss", UserInfoSetting.getBduss());
        if (!TextUtils.isEmpty(cancelReason)) {
            params.put("cancelReason", cancelReason);
        }

        if (!TextUtils.isEmpty(cancelContent)) {
            params.put("cancelContent", cancelContent);

        }

        return params;
    }
}

